#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#define maxsize 1000
using namespace std;
typedef struct{
	int data[maxsize];
	int front,rear;
}Queue;
typedef Queue * Squeue;
typedef int ElemType;
void InitQueue(Squeue &q);
void DestroyQueue(Squeue &q); 
bool QueueEmpty(Squeue q);
bool enQueue(Squeue &q,ElemType e);
bool deQueue(Squeue &q,ElemType &e);
int main()
{
	Squeue p,q; 
	int n,m;
	int i,num=0,flag=0;
	ElemType e1,e2,e3;
	scanf("%d",&n);
	InitQueue(p);
	InitQueue(q);
	for(i=1;i<=n;i++)
	{
		cin>>m;
		if(m%2==0) enQueue(p,m);
		else enQueue(q,m);
	}
	while(!QueueEmpty(q)&&!QueueEmpty(p))
	{
		deQueue(q,e1);
		deQueue(q,e2);
		deQueue(p,e3);
		if(flag==0) {
			cout<<e1;
			cout<<" "<<e2;
			cout<<" "<<e3;
			flag=1;
		}
		else{
			cout<<" "<<e1;
			cout<<" "<<e2;
			cout<<" "<<e3;
		}
	}
	while(!QueueEmpty(q)){
		deQueue(q,e1);
		deQueue(q,e2);
		if(flag==0) {
			cout<<e1;
			cout<<" "<<e2;
			flag=1;
		}
		else{
			cout<<" "<<e1;
			cout<<" "<<e2;
		}
	}
	while(!QueueEmpty(p)){
		deQueue(p,e3);
		if(flag==0) {
			cout<<e3;
			flag=1;
		}
		else{
			cout<<" "<<e3;
		}
	}
	return 0;
}

void InitQueue(Squeue &q)
{
	q=new Queue;
	q->front=q->rear=-1;
}
void DestroyQueue(Squeue &q)
{
	free(q);
}
bool QueueEmpty(Squeue q)
{
	return(q->front==q->rear);
}
bool enQueue(Squeue &q,ElemType e)
{
	if(q->rear==maxsize-1)
	    return false;
	q->rear++;
	q->data[q->rear]=e;
	return true;
}
bool deQueue(Squeue &q,ElemType &e)
{
	if(q->front==q->rear)
	    return false;
	q->front++;
	e=q->data[q->front];
	return true;
}
